home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / keyb / newkey54.zip / EXAMPLE.KEY < prev    next >
Text File  |  1990-10-27  |  13KB  |  296 lines

  1. * This macro file illustrates many of the various functions that can be
  2. * done in Newkey.  These macros are designed to be run from the DOS command 
  3. * line.  
  4. *
  5. * CED should not be loaded (if you don't know what CED is then don't 
  6. * worry, you don't have it).
  7. *
  8. * Illustrates if functions - This macro will do a "dir/p" and clear 
  9. * all "Stike a key" messages until the directory listing is done.  It does
  10. * this by starting the directory listing and then calling <chkdir1> to
  11. * do rest of processing.
  12. {begdef chkdir}dir /p<enter><chkdir1>
  13. {enddef}
  14.  
  15. * Part 2 of if function example - Logic is as follows:
  16. *
  17. *  Wait for 1/2 second to give directory listing time to fill screen
  18. *  If "bytes free" displayed then exit, directory listing is done
  19. *  If "Strike a key" displayed, then screen is full, "strike" the enter
  20. *  key to continue.
  21. *  Branch to start of macro to repeat process
  22. {begdef chkdir1}
  23. {wait 00:00:50}
  24. {ifefscr}bytes free{endifef}{return}
  25. {ifefscr}Strike a key{endifef}<enter>
  26. <chkdir1>
  27. {enddef}
  28.  
  29. * Illustrates print screen function
  30. {begdef prtscrn}Print screen{prtscrn}
  31. {enddef}
  32.  
  33. * Illustrates beep function
  34. {begdef beep}Beep now{wait 00:00:30}{beep} beep done<esc>
  35. {enddef}
  36.  
  37. * Illustrates cls the clear screen function
  38. {begdef cls}Clear the screen {cls} clear done<esc>
  39. {enddef}
  40.  
  41. * Illustrates the cursor on and off functions
  42. {begdef cursor}Turn the cursor off {cursoff} press any key to continue
  43. {waitany}<esc>
  44. Turn cursor back on {curson}
  45. {enddef}
  46.  
  47. * Illustrates date and time function formats
  48. {begdef date}<esc>cls<enter>
  49.           Sample Date Functions                            <esc>
  50. template               what Newkey returns                 <esc>
  51.  
  52. mm/dd/yy                {date}mm/dd/yy{enddate}            <esc>
  53. yy/mm/dd                {date}yy/mm/dd{enddate}            <esc>
  54. mm-dd-yy                {date}mm-dd-yy{enddate}            <esc>
  55. mm/dd/yyyy              {date}mm/dd/yyyy{enddate}          <esc>
  56.                                                            <esc>
  57. mmmm dd, yyyy           {date}mmmm dd, yyyy{enddate}       <esc>
  58. mmm dd, yyyy            {date}mmm dd, yyyy{enddate}        <esc>
  59. dddd, mmm dd, yyyy      {date}dddd, mmm dd, yyyy{enddate}  <esc>
  60. ddd, mmm dd, yyyy       {date}ddd, mmm dd, yyyy{enddate}   <esc>
  61.    <esc>
  62.           Sample Time Functions    <esc>
  63.  
  64. template     what Newkey returns             <esc>
  65.  
  66. hh:mm:ss     {time}hh:mm:ss{endtime} = twelve hour clock time <esc>
  67. hh:mm xx     {time}hh:mm xx{endtime} = twelve hour clock time <esc>
  68. hh:mm XX     {time}hh:mm XX{endtime} = twelve hour clock time <esc>
  69. tt:mm:ss     {time}tt:mm:ss{endtime} = 24 hour clock time    <esc>
  70. <esc>
  71. Press any key to learn how you can create your own date and time 
  72. macros.{waitany}
  73. <ESC>
  74. {cls}
  75. Using the basic building blocks of the date and time functions you   <esc>
  76. can build your own date/time template.  Just type these as you would <esc>
  77. like to see them when they are played back.  You are not limited to  <esc>
  78. just these building blocks.  Any characters found in the date/time   <esc>
  79. function which can not be interpreted as one of the building blocks  <esc>
  80. will be returned just as they are.  This means that you have complete<esc>
  81. flexibility in creating your own date/time function.                 <esc>
  82.                                                                      <esc>
  83. Time functions                      Date functions                   <esc>
  84.                                                                      <esc>
  85. hh = hours on twelve hour clock     dd = day                         <esc>
  86. mm = minutes                        mm = month                       <esc>
  87. ss = seconds                        yy,yyy,yyyy = year               <esc>
  88. tt = hours on 24 hour clock         ddd,mmm = 3 char abbreviation    <esc>
  89. xx = am,pm                          dddd,mmmm = full name            <esc>
  90. XX = AM,PM                                                           <esc>
  91. {enddef}
  92.  
  93. * Illustrates begprint function
  94. {begdef print}send something to printer on LPT1
  95. {begprint}hello world!<enter>{endprint}<esc>
  96. {enddef}
  97.  
  98. * Illustrates setting caps lock
  99. {begdef caps}save caps lock status{capssave}<esc>
  100. turn caps lock on{capson} - type abc {ffld}{ffld}{ffld}<esc>
  101. turn caps lock off{capsoff} - type abc {ffld}{ffld}{ffld}<esc>
  102. restore caps lock status{capsrest}<esc>
  103. {enddef}
  104.  
  105. * Illustrates setting num lock
  106. {begdef num}save num lock status{numsave}<esc>
  107. turn num lock on{numon} - type 123 on numeric keypad {ffld}{ffld}{ffld}<esc>
  108. turn num lock off{numoff} - type 123 on numeric keypad {ffld}{ffld}{ffld}<esc>
  109. restore num lock status{numrest}<esc>
  110. {enddef}
  111.  
  112. * Illustrates setting scrl lock
  113. {begdef scrl}save scrl lock status{scrlsave}<esc>
  114. turn scrl lock on{scrlon} - no way to demonstrate from dos command line<esc>
  115. turn scrl lock off{scrloff} - no way to demonstrate from dos command line<esc>
  116. restore scrl lock status{scrlrest}<esc>
  117. {enddef}
  118.  
  119. * Illustrates time function
  120. {begdef time}current time is {time}hh:mm:ss xx{endtime}<esc>
  121. {enddef}
  122.  
  123. * Illustrates available set options
  124. {begdef setopts}Merging example.key
  125. {begmerge}example.key{endmerge} Merge is done<esc>{enddef}
  126.  
  127. * Clearing macros from memory
  128. * This macro will clear all macros from memory except for guarded macros
  129. * and the macro being used to call it.  It will take longer than the same
  130. * function done from the menu.
  131. {begdef clear}Clearing macros from memory
  132. {clearmac}Clear is done<esc>{enddef}
  133.  
  134. * Merging a macro file
  135. {begdef mergfile}Merging example.key
  136. {begmerge}example.key{endmerge} Merge is done<esc>{enddef}
  137.  
  138. * Merging a macro file overwriting duplicates
  139. {begdef mergovrw}Merging example.key overwriting duplicates
  140. {begmergo}example.key{endmergo} Merge is done<esc>{enddef}
  141.  
  142. * Loading a macro file
  143. {begdef loadfile}Loading example.key
  144. {begload}example.key{endload} Load is done<esc>{enddef}
  145.  
  146. * Saving a macro file
  147. {begdef savefile}Saving example1.key
  148. {begsave}example1.key{endsave} Save is done<esc>{enddef}
  149.  
  150. * used for translation bypass demonstration
  151. {begdef &}Hello!{enddef}
  152. {begdef alt0}level0{enddef}
  153. * nested macro demonstration
  154. {begdef alt1}level1<alt2>{enddef}
  155. {begdef alt2}level2<alt3>{enddef}
  156. {begdef alt3}level3<alt4>{enddef}
  157. {begdef alt4}level4<alt5>{enddef}
  158. {begdef alt5}level5<alt6>{enddef}
  159. {begdef alt6}level6<alt7>{enddef}
  160. {begdef alt7}level7<alt8>{enddef}
  161. {begdef alt8}level8<alt9>{enddef}
  162. {begdef alt9}level9<alt0>{enddef}
  163.  
  164. * clear screen demonstration
  165. {begdef altf1}{cls}    Clear screen macro demonstration    <esc>
  166. <esc>I am going to clear your screen.  Press any key when you are  
  167. <esc>ready.{ffld}{cls}Newkey can clear your screen whenever you wis
  168. h.{enddef}
  169.  
  170. * beep demonstration
  171. {begdef altf2}{cls}<tab>  Beep macro demonstration    <esc><esc>I 
  172. am going to beep. {beep} Newkey macros can beep {beep}<esc> wheneve
  173. r you wish.<esc>{enddef}
  174.  
  175. * screen off/on demonstration
  176. {begdef altf3}{cls}<tab>  Screen off macro demonstration    <esc>
  177. <esc>I am going to turn the screen off when you hit enter.  To turn
  178.  the screen <esc>back on press any key a couple of times.  Press en
  179. ter when ready.{vfld}  <esc>{scroff}{ffld}{ffld} <esc><esc>Now I'm 
  180. going to turn off the screen for 3 seconds and then turn it on. 
  181. <esc>Press any key when ready. {ffld}{scroff}{wait 00:03:00}
  182. {scron} <esc>{enddef}
  183.  
  184. * 5 second time delay 
  185. {begdef altt}<esc>{set slowtype off}5 second time delay begins now:
  186. {wait 00:05:00}
  187.  and ends now. <esc>{enddef}
  188.  
  189. * Macro which calls itself
  190. {begdef ctrlw}<esc>{set slowtype on}Hi! I'm <caps,>ctrlw<caps.>.  I will ca
  191. ll myself over and over until you <esc>stop me by pressing <caps,>c
  192. trlesc<caps.> (ctrl\ for enhanced), the   <esc>Newkey cancel key.  
  193. <esc>I will type slowly since I have turned on slow typing mode so 
  194. that <esc>you can follow what is happening.<esc><esc><ctrlw>
  195. {enddef}
  196.  
  197. * Fixed Length Fill-in-the-blanks Pause Demonstration
  198. {begdef f1}{cls}{set slowtype off}       Fixed length fill-in-the-blanks de
  199. monstration  <esc><esc>Enter 2 keystrokes: {ffld}{ffld} and Newkey